package xhwl.hmo.mall.http.api;


import com.google.gson.Gson;

import okhttp3.RequestBody;
import rx.Observable;
import xhwl.hmo.mall.http.ApiService;
import xhwl.hmo.mall.utils.SpUtil;
import xhwl.retrofitrx.BaseApi;


public class OrderListApi extends BaseApi {
    OrderListReq req;

    public OrderListApi(int page_num, String order_status, String fh_status,String comment_status) {
        req = new OrderListReq(page_num, order_status,fh_status,comment_status);
        setShowDialog(false);
    }

    @Override
    protected Observable getObservable() {
        RequestBody requestBody = RequestBody.create(okhttp3.MediaType.parse("application/json; charset=utf-8"), new Gson().toJson(req));
        return retrofit.create(ApiService.class).getOrderList(requestBody);
    }

    public class OrderListReq {
        private String member_mobile;
        private int page_num;
        private String order_status; // 订单状态 0 -- 待付款 1--已付款 2--已退款 3--支付失败 4--消费成功
        private String fh_status;//发货状态 9表示已完成
        private String comment_status ;//评价状态 0 -- 未评价  1 -- 已评价

        public OrderListReq(int page_num, String order_status, String fh_status,String comment_status) {
            this.member_mobile = SpUtil.getString(SpUtil.MEMBER_MOBILE,"");
            this.page_num = page_num;
            this.order_status = order_status;
            this.fh_status = fh_status;
            this.comment_status = comment_status;
        }
    }
}
